package com.hexb.smh.errors;

import com.hexb.core.model.enums.BusinessExceptionEnum;

/**
 * @author : hexb
 */
public enum ErrorCodes implements BusinessExceptionEnum {

    INVALID_AMOUNT("不合法的金额格式", "invalid_amount"),
    DUPLICATE_LOGIN_NAME_OR_PHONE_NO("重复的登录名或手机号", "duplicate_login_name_or_phone_no"),
    DUPLICATE_LOGIN_NAME("重复的登录名", "duplicate_login_name"),
    DUPLICATE_PHONE_NO("重复的手机号", "duplicate_phone_no"),
    ACCOUNT_NOT_FOUND("错误的帐号", "account_not_found"),
    CANT_MODIFY_SUPER_ADMIN("不能修改超级管理员", "cant_modify_super_admin"),
    RESET_PASSWORD_FIRST("首次登录,请先修改默认密码", "reset_password_first"),
    INVALID_ENCRYPT_CONTENT("不正确的加密内容", "invalid_encrypt_content"),
    PASSWORD_COULD_NOT_NULL("密码不能设置为空", "password_could_not_null"),
    ACCOUNT_ALREADY_ACTIVATED("帐号已经更置过密码", "account_already_activated"),
    INVALID_PASSWORD_LENGTH("密码长度应在6-20位", "invalid_password_length"),
    INVALID_OLD_PASSWORD("旧密码不正确", "invalid_old_password"),
    PASSWORD_MUST_INCLUDE_LETTER_AND_DIGIT("密码必须包含数字和字母", "password_must_include_letter_and_digit"),
    COULD_NOT_REST_SELF("不能重置自己的密码", "could_not_rest_self"),
    DUPLICATE_PRODUCT_ITEM_NO("重复的产品编号", "duplicate_product_name"),
    ID_IS_NULL("参数不足,缺失ID", "id_is_null"),
    INSUFFICIENT_PARAM_BY_PRICE("参数不足,必需指定一个查询价格", "insufficient_param_by_price"),
    INVALID_VERIFICATION_CODE("验证码不正确", "invalid_verification_code"),
    REFRESH_VERIFICATION_CODE("验证码未生成,请刷新", "refresh_verification_code"),
    INVALID_PRICE("价格 {0} 格式不正确,只能包含数字和小数点", "invalid_price"),
    INVALID_EXPRESSION("公式配置有误,请检查", "invalid_expression"),
    NOT_EXCEL_FILE("导入文件只支持excel文件", "not_excel_file"),
    COMMISSION_NOT_IMPORTED("业务员提成信息未导入,请先导入", "commission_not_imported"),
    ILLEGAL_EXCEL_FORMAT("导入文件格式不合法", "Illegal_excel_format"),
    DUPLICATE_SCORE("分值{0}与评级[{1}]定义重合", "duplicate_score"),
    DUPLICATE_LEVEL_NAME("评级{0}已经存在,请使用其它名称", "duplicate_level_name"),
    INCLUDE_SCORE("分值{0}~{1}与评级{1}定义重合,请调整", "include_score"),
    DUPLICATE_SCORE_OR_NAME("评级名称或分值有重合,请调整", "duplicate_score_or_name"),
    SCORE_MUST_NOT_BOTH_NULL("分值至少需要填写一个", "score_must_not_both_null"),
    NOT_ENOUGH_ITEM("套餐中产品需要至少{0}项才能评估", "not_enough_item"),
    MISS_EXPRESSION("计算公式未配置", "expression_not_fount"),
    MISS_EVALUATE_LEVEL("未能匹配到分数[{0}]的评价等级,请配置", "miss_evaluate_level"),
    MISS_COMMISSION("未匹配到对应的销售提成率[套餐折扣率:{0},套餐市场价合计:{1}],请先配置", "miss_commission"),
    CALCULATE_FAILED("计算错误,请检查公式配置是否正确", "calculate_failed"),
    EVALUATE_FAILED("评估失败", "evaluate_failed"),
    EVALUATE_HISTORY_NOT_FOUND("评估历史不存在", "evaluate_history_not_found"),
    MARKET_PRICE_BY_ZERO("市场价合计为0,不能评估", "market_price_by_zero"),
    DISCOUNT_TOO_LOW("折扣太低,不能提交评估", "discount_too_low"),
    PRODUCT_PRICE_MUST_SET("项目价格必须设置", "product_price_must_set"),
    EXCEL_FILE_ERROR("Excel文件内容有误,请检查", "excel_file_error"),
    DEAL_PRICE_LARGE_THAN_MARKET_PRICE("成交价需要低于市场价才能评估", "deal_price_large_than_market_price"),
    ;

    final private String message;
    final private String code;
    final private String key;

    ErrorCodes(String message, String code) {
        this(message, code, code);
    }

    ErrorCodes(String message, String code, String key) {
        this.message = message;
        this.code = code;
        this.key = key;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getKey() {
        return key;
    }

}
